<template>
	<div class="ams-latex ams-latex_up">
		<div class="equation-editor-area">
			<div class="ee-item" v-for="(item,index) in files">
				<pro-upload-img
					:fileList="item.fileList"
					:maxSize="1"
					accept=".jpg,.png"
					tip="图片格式，不超过2MB"
					@success="handleSuccess"
					@error="handleError"
				/>
				<el-input style="width: 130px" v-model="item.title" placeholder="请输入标题" />

				<el-button v-if="index === 0"
						   link
						   :icon="Plus"
						   @click="addItem"
				/>
				<el-button
					v-else
					link
					type="danger"
					:icon="Delete"
					@click="removeItem(index)"
				/>
			</div>
		</div>
		<div class="equation-editor-close">
			<el-icon class="icon-close" @click="close">
				<Close />
			</el-icon>
		</div>
	</div>
</template>
<script setup lang="ts">
import { Close, Delete, Plus } from '@element-plus/icons-vue';
import ProUploadImg from '/#/upload/index.vue';
import { ref } from 'vue';
const files = ref([
	{
		fileList: [],
		title: ''
	}
]);
const emit = defineEmits(['close']);
const addItem = () => {
	files.value.push({
		fileList: [],
		title: ''
	});
}
const close = () => {
	emit('close')
}
const removeItem = (index: number) => {
	files.value.splice(index, 1)
}
const handleSuccess = (response, uploadFile, uploadFiles) => {

}
const handleError = () => {

}
</script>

